#!/usr/bin/env python
#coding=utf-8
'''
Created on 2010-7-13

@author: lxd
'''
import wx
from bin_pageIndex import PageIndex
from bin_pageSet import PageSet
from bin_pageInfo import PageInfo
class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "bin")
        self.palMain = wx.Panel(self)                
        self.lblTop = self.createTop()        
        self.nbMain = self.createNoteBook() 
        self.layout() 
        self.Center()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        
    def createTop(self):
        lblTop = wx.StaticText(self.palMain, -1, u"YY365小号大管家")
        lblTop.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
        return lblTop
              
    def createNoteBook(self):
        nbMain = wx.Notebook(self.palMain)
        self.pageIndex = PageIndex(nbMain)
        self.pageSet = PageSet(nbMain)
        self.pageInfo = PageInfo(nbMain)
        nbMain.AddPage(self.pageIndex, u"主页面")
        nbMain.AddPage(self.pageSet, u"软件设置")
        nbMain.AddPage(self.pageInfo, u"关于")
        return nbMain
             
    def layout(self):
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.lblTop, 0, wx.ALL, 5)
        mainSizer.Add(wx.StaticLine(self.palMain), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        mainSizer.Add(self.nbMain, 1, wx.EXPAND)
        self.palMain.SetSizer(mainSizer)
        mainSizer.Fit(self)
        mainSizer.SetSizeHints(self)
        
    def OnClose(self, event):
        self.pageIndex.saveInfoData()  
        self.Destroy()
              
if __name__ == "__main__":
    app = wx.App()
    MainFrame().Show()
    app.MainLoop()

